import 'package:flutter/material.dart';
import 'package:sonora/shared/lib/constants/sj_colors.dart';
import 'package:sonora/utils/sj_text_style.dart';

class SjMedalUpgradeDialog extends StatelessWidget {
  final String? assetPath;
  final String? content;
  final VoidCallback? onAgree;
  final VoidCallback? onCancel;
  final String? cancel;
  final String? agree;

  const SjMedalUpgradeDialog(
      {Key? key,
      this.assetPath,
      this.content,
      this.onAgree,
      this.onCancel,
      this.cancel,
      this.agree})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Dialog(
        shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(1.0)),
        child: Container(
          padding: EdgeInsets.all(3),
          decoration: BoxDecoration(color: SjColors.blackColor, boxShadow: [
            BoxShadow(color: SjColors.themeColor, offset: Offset(2, 2))
          ]),
          child: Container(
            color: SjColors.textWhiteColor,
            child: Padding(
              padding: const EdgeInsets.all(14.0),
              child: Column(
                mainAxisSize: MainAxisSize.min,
                children: [
                  assetPath != null
                      ? Image(
                          image: AssetImage(assetPath ?? ''),
                          width: 80,
                          height: 80,
                        )
                      : SizedBox(),
                  SizedBox(
                    height: 12,
                  ),
                  Text(
                    content ?? '',
                    textAlign: TextAlign.center,
                    style: SjTextStyle.customFontBlack16,
                  ),
                  SizedBox(
                    height: 14,
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      onCancel != null
                          ? TextButton(
                              onPressed: () {
                                onCancel?.call();
                                Navigator.of(context).pop();
                              },
                              style: TextButton.styleFrom(
                                  backgroundColor: SjColors.themeAColor, // 设置背景色
                                  padding: EdgeInsets.symmetric(
                                      horizontal: 20, vertical: 12), // 设置内边距
                                  shape: RoundedRectangleBorder(
                                    borderRadius:
                                        BorderRadius.circular(27), // 设置圆角
                                  ),
                                  minimumSize: Size(118, 40)),
                              child: Text(
                                cancel ?? "NO",
                                style: SjTextStyle.customFontTheme16, // 设置文本颜色
                              ),
                            )
                          : SizedBox(),
                      onCancel != null ? SizedBox(width: 12) : SizedBox(),
                      TextButton(
                        onPressed: () {
                          onAgree?.call();
                          Navigator.of(context).pop();
                        },
                        style: TextButton.styleFrom(
                            backgroundColor: SjColors.blackColor, // 设置背景色
                            padding: EdgeInsets.symmetric(
                                horizontal: 20, vertical: 12), // 设置内边距
                            shape: RoundedRectangleBorder(
                              borderRadius: BorderRadius.circular(27), // 设置圆角
                            ),
                            minimumSize: Size(118, 40)),
                        child: Text(
                          agree ?? "OK",
                          style: SjTextStyle.customFontTheme16, // 设置文本颜色
                        ),
                      ),
                    ],
                  )
                ],
              ),
            ),
          ),
        ));
  }
}
